<template>
  <div>
    <div class="action-bar">
      <el-button type="primary" size="mini" icon="el-icon-plus" @click="add">新建</el-button>
    </div>
    <FormDialog v-if="dialogEditFormVisible" custom-class="second-dialog-height" title="新建" :show="dialogEditFormVisible" width="90%" @on-ok="ok" @on-cancel="cancel">
      <EditForm ref="editForm" />
    </FormDialog>
  </div>
</template>
<script>
import FormDialog from '@neu/biz-core/components/FormDialog'
import EditForm from './editForm'
export default {
  name: 'StopServiceNoticeActionBar',
  components: {
    FormDialog,
    EditForm
  },
  data() {
    return {
      dialogEditFormVisible: false
    }
  },
  methods: {
    add() {
      this.dialogEditFormVisible = true
    },
    ok() {
      this.$refs.editForm.save().then(response => {
        if (response === false) return
        this.$message({
          showClose: true,
          message: '操作成功！',
          type: 'success'
        })
        this.$parent.refresh()
        this.$refs.editForm.reset()
        this.dialogEditFormVisible = false
      })
    },
    cancel() {
      this.$refs.editForm.reset()
      this.dialogEditFormVisible = false
    }
  }

}
</script>
